//
//  SWBook.h
//  YiyaPuzzleDemo
//
//  Created by linhan on 16/9/29.
//  Copyright © 2016年 test. All rights reserved.
//

#import <Mantle.h>

typedef NS_ENUM(NSInteger, SWBookCategory) {
    event = 0,
    subject,
    custom
};

@interface SWBooks : MTLModel
@property(nonatomic, strong) NSString *bookID;
@property(nonatomic, strong) NSArray *books;
@end

@interface SWBook : MTLModel
@property(nonatomic, strong) NSString *title;             //书名
@property(nonatomic, strong) NSString *bookID;
@property(nonatomic, assign) SWBookCategory  category;
@property(nonatomic, strong) NSString *templateID;        //模板ID
@property(nonatomic, assign) NSInteger version;           //
@property(nonatomic, assign) NSInteger index;             //索引，用于列表排序
@property(nonatomic, strong) NSArray *pages;
@end

@interface SWPage : MTLModel
@property(nonatomic, strong) NSString *title;             //事件名\主题
@property(nonatomic, assign) NSInteger version;
@property(nonatomic, assign) SWBookCategory  category;
@property(nonatomic, strong) NSString *eventID;
@property(nonatomic, strong) NSString *bookID;
@property(nonatomic, strong) NSString *orderID;           //如果当前页面已经提交订单，则合成图放于订单目录下
@property(nonatomic, strong) NSString *pageID;            //用于更新某本书某个页面
@property(nonatomic, strong) NSString *previewBgURL;      //背景小图
@property(nonatomic, strong) NSString *previewResultURL;  //合成后的小图；当此页面不是本人编辑的，则只加载预览小图
@property(nonatomic, strong) NSString *largeBgURL;        //背景大图
@property(nonatomic, strong) NSString *largeResultURL;    //合成后的大图
@property(nonatomic, strong) NSString *printID;           //打印标识
@property(nonatomic, strong) NSArray *photos;
@property(nonatomic, strong) NSArray *texts;
@property(nonatomic, assign) NSInteger photoImportedTime; //照片入驻时间(1970以来秒数)
@property(nonatomic, assign) BOOL importedFirstTime;      //是否第一次导入，用于小红点标记
@property(nonatomic, assign) BOOL modified;
@property(nonatomic, assign) BOOL whitespace;               //是否空白页面
@property(nonatomic, assign) BOOL unlock;                   //页面跟事件强相关，只有达到一定条件才解锁
@property(nonatomic, assign) BOOL read;                     //解锁后是否看过此页，用于小红点标记
//@property(nonatomic, assign) BOOL editable;               //是否可编辑,此属性默认为nil，如无特殊声明，默认可编辑（根据规则，谁创建谁编辑）

@end

@interface SWPhoto : MTLModel
@property (nonatomic, strong) NSString *imageID;
@property (nonatomic, strong) NSString *localID;
@property (nonatomic, strong) NSString *remoteURL;
@property (nonatomic, strong) NSString *sectionID;   //段位
@property (nonatomic, strong) NSString *text;        //附带文字
@property (nonatomic, strong) NSNumber  *createDate; //1970以来秒数
@property (nonatomic, assign) double  xPercent;
@property (nonatomic, assign) double  yPercent;
@property (nonatomic, assign) double  widthPercent;
@property (nonatomic, assign) double  heightPercent;
@end

@interface SWText : MTLModel
@property (nonatomic, strong) NSString *text;
@property (nonatomic, strong) NSString *textColor;
@property (nonatomic, assign) NSInteger fontSize;       //文字大小
@property (nonatomic, assign) double  xPercent;
@property (nonatomic, assign) double  yPercent;
@property (nonatomic, assign) double  widthPercent;
@property (nonatomic, assign) double  heightPercent;
@end

//页面中每个图片的记录
@interface SWBookAssetRecord : MTLModel
@property (nonatomic, strong) NSString *imageID;
@property (nonatomic, strong) NSString *localID;        //通过localID获取到相册中具体图片
@property (nonatomic, assign) BOOL modified;            //对应的图片是否编辑过
@end

@interface SWOrderRecord : MTLModel
@property (nonatomic, strong) NSString *orderID;        //订单ID
@property (nonatomic, assign) BOOL valid;            //订单是否有效
@property (nonatomic, strong) NSArray *pages;
@end

@interface SWBookTemplate : MTLModel
@property (nonatomic, assign) SWBookCategory  category;
@property(nonatomic, strong) NSString *title;             //书名
@property(nonatomic, strong) NSString *templateID;        //模板ID
@property(nonatomic, assign) NSInteger version;           //模板的版本大于本地版本，对本地版本进行更新
@property(nonatomic, strong) NSArray *pages;
@end

//页面模板
@interface SWPageTemplate : MTLModel
@property(nonatomic, assign) NSInteger version;
@property(nonatomic, strong) NSString *title;
@property(nonatomic, strong) NSString *eventID;
@property(nonatomic, strong) NSString *pageID;            //页面模板ID
@property(nonatomic, strong) NSString *previewBgURL;      //背景小图
@property(nonatomic, strong) NSString *largeBgURL;        //背景大图
@property(nonatomic, strong) NSArray *photos;
@property(nonatomic, strong) NSArray *texts;
@end

@interface SWPhotoTemplate : MTLModel
@property (nonatomic, assign) double  xPercent;
@property (nonatomic, assign) double  yPercent;
@property (nonatomic, assign) double  widthPercent;
@property (nonatomic, assign) double  heightPercent;
@end

@interface SWTextTemplate : MTLModel
@property (nonatomic, strong) NSString  *defaultText;   //默认文字
@property (nonatomic, strong) NSString *textColor;      //文字颜色
@property (nonatomic, assign) NSInteger fontSize;       //文字大小
@property (nonatomic, assign) double  xPercent;
@property (nonatomic, assign) double  yPercent;
@property (nonatomic, assign) double  widthPercent;
@property (nonatomic, assign) double  heightPercent;
@end
